package com.yanqu.road.entity.config.beauty;

import com.yanqu.road.entity.player.UserPatrons;

import java.util.Objects;

public class BeautyRelation {

    private int beautyId;

    private int patronsId;

    private String getCondition;

    public int getBeautyId() {
        return beautyId;
    }

    public void setBeautyId(int beautyId) {
        this.beautyId = beautyId;
    }

    public int getPatronsId() {
        return patronsId;
    }

    public void setPatronsId(int patronsId) {
        this.patronsId = patronsId;
    }

    public String getGetCondition() {
        return getCondition;
    }

    public void setGetCondition(String getCondition) {
        this.getCondition = getCondition;
    }

    public boolean passCondition(UserPatrons patrons) {
        if (patrons == null) {
            return false;
        }
        if (patrons.getPatronsId() != patronsId) {
            return false;
        }
        if (Objects.equals("0", getCondition)) {
            return true;
        }
        String[] arr = getCondition.split("=");
        int type = Integer.parseInt(arr[0]);
        if (type == 1) {
            //目前只有type1
            int promotionId = Integer.parseInt(arr[1]);
            if (patrons.getShowPromotionId() >= promotionId) {
                return true;
            }
        }
        return false;
    }

}
